<html><head><title>z-score: Assessing selection</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>zbins(LGS)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   zbins">
<param name="keyword" value=" z-score: Assessing selection">
</object>


<h2>z-score: Assessing selection</h2>


<h3>Description</h3>

<p>
A criterion to assess the statistical significance of selection acting on a given marker or group of markers is to calculate its deviation from the mean of all the markers assayed. <code>zbins</code> groups adjacent markers in bins and calculates for each bin the zscore of the allele ratio relative to the whole set of bins. The bin z-score can therefore be considered a measure of signifincae for a putative selection valley.
</p>


<h3>Usage</h3>

<pre>
zbins(allRatio=NULL, bins=NULL)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>allRatio</code></td>
<td>
A vector of allele ratios or an object of class <code>LGS</code> (i.e. output of <code><a href="simLGS.html">simLGS</a></code>) </td></tr>
<tr valign="top"><td><code>bins</code></td>
<td>
A vector of the same length as <code>allRatio</code> specifying which markers should be grouped together. If the argument passed to <code>allRatio</code> is a <code>link{simLGS}</code> list, <code>zbins</code> will search for the <code>simLGS$ChrMap$Bins</code> vector. </td></tr>
</table>

<h3>Details</h3>

<p>
<code>zbins</code> first calculates the z-score of each marker, then assigns to each bin the mean z-score based on the markers contained in each bin. 
If a vector of bins is supplied both within a <code><a href="simLGS.html">simLGS</a></code> list and thorugh <code>bins</code> argument, the vector in <code>bins</code> will be used.
</p>


<h3>Value</h3>

<p>
A vector of z-scores, one for each different bin in <code>bins</code>.</p>

<h3>Author(s)</h3>

<p>
Dario Beraldi &lt;<a href="mailto:dario.beraldi@ed.ac.uk">dario.beraldi@ed.ac.uk</a>&gt;
</p>


<h3>See Also</h3>

<p>
<code><a href="plotBins.html">plotBins</a></code> to plot bin z-score as a genome scan.
</p>


<h3>Examples</h3>

<pre>
data(pcMap)
# An example of how bins are constructed (show chr 14)
pcMap[pcMap$Chr=="14", 1:4]

# A simulation to work with
lgs1&lt;- simLGS(offspring=100, scenario="EqualFitness99", gen.dist="phy", map=pcMap)
plotLGS(lgs1)

# Using bins provided in pcMap
bin1&lt;- zbins(lgs1, pcMap$Bins)
# z-score at the most selected valley
min(bin1) # (Assuming we are interested in valleys, not peaks. 
          # Use max(bin1) or max(abs(bin1)) otherwise)
# Bin containing the lowest score
unique(pcMap$Bins)[which(min(bin1)==bin1)]

# z-score of each chromosome
binChr&lt;- zbins(lgs1, pcMap$Chr)
# z-score of the most selected chromosome
min(binChr)
unique(pcMap$Chr)[which(binChr == min(binChr))]

# z-score of each marker
zMarker&lt;- zbins(lgs1, pcMap$Locus)
# z-score of the most selected marker
min(zMarker)
# Marker at the bottom of the valley
pcMap$Locus[which(zMarker==min(zMarker))]

# In this case, maybe better
plotLGS(allRatio= zMarker, cumDist= lgs1$ChrMap$CumDist, chr= lgs1$ChrMap$Chr)

</pre>



<hr><div align="center">[Package <em>LGS</em> version 0.9 <a href="00Index.html">Index]</a></div>

</body></html>
